﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace MapEditorMario
{
    class QNode
    {
        #region variable
        //private Rectangle rect;     //Screen bounding square
        private int level;          //muc cua node

        private int x1, y1, x2, y2;
        private int size;

        QNode left_top;
        QNode right_top;
        QNode left_bottom;
        QNode right_bottom;

        List<CTreeObject> obj_list;

        List<int> idTiles_list;

        int idNode;

        #endregion

        #region properties

        public int Size
        {
            get { return this.size; }
        }
        public int Level
        {
            get { return level; }
        }
        public int IDNode
        {
            get { return idNode; }
        }

        public int Y2
        {
            get { return y2; }
        }
        public int X2
        {
            get { return x2; }
        }
        public int Y1
        {
            get { return y1; }
        }
        public int X1
        {
            get { return x1; }
        }

        public QNode LeftTop
        {
            get { return left_top; }
            set { left_top = value; }
        }

        public QNode RightTop
        {
            get { return right_top; }
            set { right_top = value; }
        }

        public QNode LeftBottom
        {
            get { return left_bottom; }
            set { left_bottom = value; }
        }

        public QNode RightBottom
        {
            get { return right_bottom; }
            set { right_bottom = value; }
        }

        public List<CTreeObject> ObjList
        {
            get { return obj_list; }
        }
        #endregion
        
         

        public QNode(int x1, int y1, int width, int height, int level, int id)
        {
            this.x1 = x1;
            this.y1 = y1;
            this.x2 = x1 + width;
            this.y2 = y1 + height;
            //this.rect = new Rectangle(this.x1, this.y1, width, height);
            this.left_top = null;
            this.right_top = null;
            this.left_bottom = null;
            this.right_bottom = null;
            this.level = level;
            this.idNode = id;

            this.obj_list = new List<CTreeObject>();

        }

        public QNode(int x1, int y1, int size, int level, int id)
        {
            this.x1 = x1;
            this.y1 = y1;
            this.x2 = x1 + size;
            this.y2 = y1 + size;
            this.size = size;
            //this.rect = new Rectangle(this.x1, this.y1, width, height);
            this.left_top = null;
            this.right_top = null;
            this.left_bottom = null;
            this.right_bottom = null;
            this.level = level;
            this.idNode = id;

            this.obj_list = new List<CTreeObject>();

        }

        public void addCTreeObject(CTreeObject obj)
        {
            this.obj_list.Add(obj);
        }

        public void addTiles(int idTiles)
        {
            this.idTiles_list.Add(idTiles);
        }
    }
}
